package main

import "fmt"

type Pay interface {
	DoPay(price int64) string
}

type AliPay struct{}

type WechatPay struct{}

type PayType int

const (
	AliPayType    PayType = 1
	WechatPayType PayType = 2
)

func (m *AliPay) DoPay(price int64) string {
	return "支付宝支付"
}
func (m *WechatPay) DoPay(price int64) string {
	return "微信支付"
}

func NewPay(payType PayType) Pay {
	switch payType {
	case AliPayType:
		return &AliPay{}
	case WechatPayType:
		return &WechatPay{}
	default:
		return nil
	}
}

func main() {
	pay := NewPay(AliPayType)
	fmt.Println(pay.DoPay(100))
	pay = NewPay(WechatPayType)
	fmt.Println(pay.DoPay(200))
}
